*******************************
* IRCA and Redistricting
* Navid Sabet and Noam Yuchtman
* Figure 5: IRCA and county covariates (long difference)
*******************************

	//Load data
	use irca_gerrymander.dta, clear

	//Clustering
	global cluster id
		
	//Fixed effects 
	global fe id StateFIPS#year i.unassigned_county#i.year c.hisp_share1980#i.year 
	
	//Drop single district states
	 drop if single_district1990==1 
	
********************************
* Two time periods with fixed effects
******************************** 
	gen irca_std_pop = irca_std
	gen irca_std_incpc = irca_std
	gen irca_std_birth = irca_std
	gen irca_std_house_val = irca_std
	gen irca_std_spr030 = irca_std
	gen irca_std_hispanic = irca_std
	gen irca_std_crime = irca_std
	gen irca_std_fed = irca_std

	
	reghdfe population_bea_std c.irca_std_pop##i.p86 if year == 1990 |year==1980, a($fe) cluster(id)
		eststo pop_xsec
	
	reghdfe personal_inc_pc_std c.irca_std_incpc##i.p86 if year == 1990 |year==1980 , a($fe) cluster(id)
		eststo income_pc_xsec
	
	reghdfe births_std c.irca_std_birth##i.p86 if year == 1990 |year==1980, a($fe) cluster(id)
		eststo births_xsec
	
	
	reghdfe housing_value_std c.irca_std_house_val##i.p86 if year == 1990 |year==1980, a($fe) cluster(id)
		eststo value_xsec
	
	reghdfe spr030_std c.irca_std_spr030##i.p86 if year == 1990 |year==1980, a($fe) cluster(id)
		eststo security_payment
	
	reghdfe his020_std c.irca_std_hispanic##i.p86 if year == 1990 |year==1980, a($fe) cluster(id)
		eststo hisp_xsec
	
	reghdfe crime_std c.irca_std_crime##i.p86 if year == 1990 |year==1982, a($fe) cluster(id)
		eststo crime_xsec
	
	reghdfe fed150_std c.irca_std_fed##i.p86 if year == 1990 |year==1984, a($fe) cluster(id)
		eststo fed_xsec
		
coefplot 	pop_xsec income_pc_xsec births_xsec value_xsec security_payment hisp_xsec crime_xsec fed_xsec, ///
			keep(1.p86#*) ///
			xline(0, )  nokey ciopts(recast(rcap) lcolor(gs8)) msymbol(smcircle) grid(none) ///
			coeflabels(1.p86#c.irca_std_pop = "Population" ///
						1.p86#c.irca_std_incpc = "Income per capita" ///
						1.p86#c.irca_std_birth = "Birth Rate" ///
						1.p86#c.irca_std_house_val = "Housing Value" ///
						1.p86#c.irca_std_spr030 = "Social Security Payments" ///
						1.p86#c.irca_std_hispanic = "Hispanic Population" ///
						1.p86#c.irca_std_crime = "Violent Crimes" ///
						1.p86#c.irca_std_fed = "Federal Expenditure" ) ///
			title(" ") offset(1/128)
					
			graph export "fig5.pdf", replace

	
